<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        .container{
            width: 1000px;
            margin: 0 auto;
            padding: 30px;
            background-color: #fed;
        }
        .price{
            font-size:25px;
            color:#ff0000;
            font-family: 'monaco';
            font-weight: 700;
        }
    </style>
</head>
<body>
<div class="container">
    <h1>BTC 行情</h1>
    <hr>
    <ul id="btc">

    </ul>

</div>


{js href="/static/index/js/jquery.min.js"}
<script>
$(function (){
    getAjax();
    setInterval(getAjax, 5000);

    function getAjax() {
        $.ajax({
            url: "{:url('index/btc/getPrices')}",
            type: 'get',
            dataType: 'json',
            success: function (data) {
                console.log(data);

                $('#btc').empty();
                for (var i in data) {
                    $('<li>', {
                        'class': 'price',
                        text: i + ' : ' + data[i].buy.toFixed(2) + data[i].symbol
                    }).appendTo('#btc');
                }

            }
        });
        $('#btc').slideToggle(5000);
    }




});

</script>
</body>
</html>